#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :BaseModels.py
# @Time      :2024/11/8 23:13
# @Author    :zhou_yi
from datetime import datetime
from pydantic import BaseModel, Field
from typing import Optional


class CompanyBaseModel(BaseModel):
    id: str = Field(..., alias='_id')
    ABC: str
    name: str
    jur_person: Optional[str] = ''
    address: Optional[str] = ''
    tax: Optional[str] = ''
    bank: Optional[str] = ''
    account: Optional[str] = ''
    tel_1: Optional[str] = ''
    relation: Optional[str] = ''
    user: Optional[str] = ''
    tel_2: Optional[str] = ''


class PointBaseModel(BaseModel):
    id: str = Field(..., alias='_id')
    point: str
    long: float = 0.0
    lat: float = 0.0
    name: str = ''
    customID: str = ''
    custom: str = ''
    part: str = ''
    manager: str = ''
    tel: str = ''
    notice: str = ''
    address: str = ''
    code: str = "#"


class ClearWasterRecordBaseModel(BaseModel):
    id: str = Field(..., alias='_id')
    fk: str
    datetime: datetime
    w_total: int = 0
    is_really: int = 1
    w1: int = 0
    w2: int = 0
    w3: int = 0
    w4: int = 0
    w5: int = 0
    w6: int = 0
    w7: int = 0
    w8: int = 0


if __name__ == '__main__':
    company = {'_id': 'c-0002',
               'ABC': '盈兆鑫',
               'name': '北京盈兆鑫再生资源回收市场有限公司',
               'jur_person': '杜雪元',
               'address': '北京市顺义区南法信镇南卷村东侧200米',
               'tax': '91110113777677862R',
               'bank': '北京农商银行顺义支行',
               'account': '',
               'tel_1': '',
               'relation': '',
               'user': '',
               'tel_2': ''
               }

    point = {
        "_id": "p-1001",
        "point": "顺商总部",
        "long": 116.6575683,
        "lat": 40.1348536,
        "name": "顺商总部",
        "customID": "c-0006",
        "custom": "顺商集团",
        "part": "顺商总部",
        "manager": "孟远",
        "tel": "13681203547",
        "notice": "进大门右转",
        "address": "北京市顺义区新顺南大街5号",
        "code": "#"
    }

    record = {'_id': 'f989cd03-a99b-47a6-b8fa-49a93b737f1b',
              'fk': 'p-1034',
              'datetime': '2024-11-12 17:00:00',
              'w_total': 111,
              # 'is_really': 0,
              'w1': 11, 'w2': 16, 'w3': 12, 'w4': 13, 'w5': 19, 'w6': 15, 'w7': 10, 'w8': 15}

    c = CompanyBaseModel(**company)
    print(c.dict())
    # p = PointBaseModel(**point)
    # print(p)
    # r = ClearWasterRecordBaseModel(**record)
    #
    # print(r)
